/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package common.io;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 *
 * @author risto
 */
public class Format {

    private static DateFormat df = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss.SSS");

    public static String formatDate(Date date)
    {
        return df.format(date);
    }

    public static String formatFloat(double d)
    {
        return String.format("%.2f", d);
    }

    public static String commaList(List<String> lst)
    {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < lst.size(); i++) {
            sb.append(lst.get(i));
            if (i != lst.size() -1 ) sb.append(",");
        }
        return sb.toString();
    }
}
